package com.smartremote.sillyagent;

import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;

import android.util.Log;


public class FileUtil {
    private static final String TAG = FileUtil.class.getSimpleName();

    public static boolean writeBytesToFile(byte[] data, String filename) {
        File file = new File(filename);
        FileOutputStream out = null;
        try {
            out = new FileOutputStream(file);
            out.write(data);
            out.close();
            out = null;
        } catch (IOException e) {
            Log.e(TAG, "IO Exception in writeBytesToFile()");
            e.printStackTrace();
            try {
                if (out != null) {
                    out.close();
                }
            } catch (IOException e1) {
            }
            return false;
        }
        return true;
    }
}
